<?php
//require "function_pool.php";
/*This file act as a traffic controller or a router.
 * every page that wants to direct to another page will set a code name in $_SESSION['referer']
 * and use 'connector.php' to send to referer.
 * referer will act upon the code in $_SESSION['referer'] and will refer to the desired page.
 * if the code is not within the referer the user will be directed to a "page was not found"
 * 
 * pros: 	- if location of a file changes, the changes will be made only in referer
 * 			- if a link breaks, user will be directed to "page was not found"
 * 			- security issues
 * 
 * */
session_start();
if(isset($_SESSION['referer']))
{
	switch($_SESSION['referer'])
	{
		case "login":
			session_start();
			$_SESSION['username'] = $_POST['username'];
			$_SESSION['password'] = $_POST['password'];
			header('Location: login.php');
			break;
		case "index":
			header('Location: index.php');
			break;
			
		default:
	//		Pool.write_log();
			echo "page not found";
			break;
	}
}
else
	echo "page not found";

?>